#define _CRT_SECURE_NO_WARNINGS
//struct ListNode* reverseList(struct ListNode* head) {
//    struct ListNode* curr = head;
//    struct ListNode* pre = NULL;
//    while (curr)
//    {
//        struct ListNode* temp = curr->next;
//        curr->next = pre;
//        pre = curr;
//        curr = temp;
//
//    }
//    return pre;
//}
struct ListNode* reverse(struct ListNode* curr, struct ListNode* prew) {
    if (!curr) {
        return prew;
    }

    struct ListNode* temp = curr->next;
    curr->next = prew;
    return reverse(temp, curr);
}
struct ListNode* reverseList(struct ListNode* head)
{
	return reverse(head, NULL);
}